package net.huashitong.oversee.dao;

import com.sirdc.modules.core.dao.GenericQuery;
import com.sirdc.modules.core.dao.StringDao;
import net.huashitong.oversee.entity.Inspectors;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public class InspectorsDao extends StringDao<Inspectors> {

    public List<Inspectors> queryByGroupTypeId(String groupTypeId) {
        GenericQuery query = createQuery("obj");
        query.append(" and obj.groupTypeId=:groupTypeId").setParam("groupTypeId", groupTypeId);
        return query.listResult();
    }

    /**
     * 查询所有督查人员
     * @return
     */
    public List<Inspectors> queryAllInspectors(){
        GenericQuery query = createQuery("obj");
        //是督查组成员
        query.append(" and obj.isInspectors=:isInspectors").setParam("isInspectors", "1");
        query.append("GROUP BY industry_type");
        return query.listResult();
    }
}
